package com.typhosoft.jcommon.bean;

import java.io.Serializable;

/**
 * Created by Mario on 21/03/2014.
 */
public class CPhoto implements Serializable {
    private CUser user;
    private byte[] image ;

    public CPhoto() {
    }

    public CPhoto(CUser user, byte[] image ) {
        this.user = user;
        this.image  = image ;
    }

    public byte[] getImage() {
        return image ;
    }

    public void setImage(byte[] image) {
        this.image  = image ;
    }

    public CUser getUser() {
        return user;
    }

    public void setUser(CUser user) {
        this.user = user;
    }
/*
    private void writeObject(ObjectOutputStream out) throws IOException {
        out.writeObject(user);
        out.write(image);
    }

    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
        user = (CUser) in.readObject();
        byte[] buffer = new byte[1024*1024];
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        while(in.available() > 0){
            int read = in.read(buffer);
            outputStream.write(buffer, 0, read);
        }
        image = outputStream.toByteArray();
    }*/
}
